<?php
/**
 *   This file is part of GeoArticle (a Joomla plugin).
 *   Written by Ivar Bergman (www.ivarbergman.se)
 *   Copyright (c) 2010 Ivar Bergman. All rights reserved.
 *
 *   GeoArticle is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   GeoArticle is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with GeoArticle.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

  // no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

jimport('joomla.application.component.view');

class GeoArticleViewGeoArticle extends JView
{

  function display($tpl = null)
  {
    global $mainframe, $option;

    $db  =& JFactory::getDBO();
    $uri =& JFactory::getURI();

    $filter_state     = $mainframe->getUserStateFromRequest( $option.'filter_state',     'filter_state',     '',      'word' );
    $filter_catid     = $mainframe->getUserStateFromRequest( $option.'filter_catid',     'filter_catid',     0,       'int' );
    $filter_order     = $mainframe->getUserStateFromRequest( $option.'filter_order',     'filter_order',     'ga.ordering', 'cmd' );
    $filter_order_Dir = $mainframe->getUserStateFromRequest( $option.'filter_order_Dir', 'filter_order_Dir', 'asc',   'word' );
    $search           = $mainframe->getUserStateFromRequest( $option.'search',           'search',           '',      'string' );
    $search           = JString::strtolower( $search );

    // Get data from the model
    $items      = & $this->get( 'Data');
    $total      = & $this->get( 'Total');
    $pagination = & $this->get( 'Pagination' );

    // state filter
    $lists['state'] = JHTML::_('grid.state',  $filter_state );

    // table ordering
    $lists['order_Dir'] = $filter_order_Dir;
    $lists['order'] = $filter_order;

    // search filter
    $lists['search']= $search;
    
    $this->assignRef('user',    JFactory::getUser());
    $this->assignRef('lists',   $lists);
    $this->assignRef('items',   $items);
    $this->assignRef('pagination',  $pagination);

    parent::display($tpl);
  }

}
